home *** CD-ROM | disk | FTP | other *** search
/ Freelog 117 / FreelogNo117-OctobreNovembre2013.iso / Programmation / jedit / jedit5.1.0install.exe / {app} / modes / coffeescript.xml < prev    next >
Extensible Markup Language  |  2013-07-28  |  6KB  |  208 lines

  1. <?xml version="1.0"?>
  2. <!DOCTYPE MODE SYSTEM "xmode.dtd">
  3.  
  4. <!-- CoffeeScript mode by Dennis Hotson, Balazs Toth, Marc H├ñfner
  5.  
  6. Beta
  7.  
  8. TODO:
  9. - reconsider (un)indentation rules for brackets
  10. -->
  11. <MODE>
  12.     <PROPS>
  13.         <PROPERTY NAME="commentStart" VALUE="###" />
  14.         <PROPERTY NAME="commentEnd" VALUE="###" />
  15.         <PROPERTY NAME="lineComment" VALUE="#" />
  16.         <PROPERTY NAME="wordBreakChars" VALUE=",+-=<>/?^&*" />
  17.  
  18.         <!-- Auto indent -->
  19.         <PROPERTY NAME="indentNextLines"
  20.             VALUE="((\s*|.*\s+)([\-=]>|[\+\-\*/%\\<>=\!&\|\^~]|(.*:|<<|>>|>>>|\+=|\-=|\*=|/=|%=|<=|>=|==|===|\!=|\!==|is|isnt|not|and|or|&&|\|\||of|in|loop))|\s*(if|else|try|catch|finally|class|while|until|for)(\s*|\s+.*))\s*" />
  21.  
  22.         <PROPERTY NAME="unindentThisLine"  VALUE="^\s*(else|catch|finally)(\s*|\s+.*)$" />
  23.         <PROPERTY NAME="unindentNextLines" VALUE="^\s*(else|catch|finally)(\s*|\s+.*)$" />
  24.  
  25.         <!-- Props regarding brackets generally do not play well with CoffeScript -->
  26.  
  27.         <!-- Triggers reindentation on character input.
  28.         TODO: reconsider the use of this one, including "ehy" -->
  29.         <!-- PROPERTY NAME="electricKeys" VALUE="}])" /-->
  30.  
  31.         <!-- Originally designed for Python, does not work correctly with CS -->
  32.         <!-- PROPERTY NAME="ignoreWhitespace" VALUE="false" /-->
  33.     </PROPS>
  34.  
  35.     <RULES
  36.         IGNORE_CASE="FALSE"
  37.         HIGHLIGHT_DIGITS="TRUE"
  38.         NO_WORD_SEP="$_"
  39.         DIGIT_RE="(0b[01]+)|(0o[0-7]+)|(0x\p{XDigit}+)|(\d*\.?\d+(e[+-]?\d+)?)">
  40.  
  41.         <SPAN_REGEXP TYPE="COMMENT2" HASH_CHARS="###">
  42.             <BEGIN>###(?!#)</BEGIN>
  43.             <END REGEXP="TRUE">#{3,}</END>
  44.         </SPAN_REGEXP>
  45.         <EOL_SPAN TYPE="COMMENT1">#</EOL_SPAN>
  46.  
  47.         <SPAN TYPE="LITERAL1" NO_LINE_BREAK="FALSE" ESCAPE="\" DELEGATE="doubleQuoteLiteral">
  48.             <BEGIN>"""</BEGIN>
  49.             <END>"""</END>
  50.         </SPAN>
  51.  
  52.         <SPAN TYPE="LITERAL2" NO_LINE_BREAK="FALSE" ESCAPE="\">
  53.             <BEGIN>'''</BEGIN>
  54.             <END>'''</END>
  55.         </SPAN>
  56.  
  57.         <SPAN TYPE="LITERAL1" NO_LINE_BREAK="FALSE" ESCAPE="\" DELEGATE="doubleQuoteLiteral">
  58.             <BEGIN>"</BEGIN>
  59.             <END>"</END>
  60.         </SPAN>
  61.  
  62.         <SPAN TYPE="LITERAL2" NO_LINE_BREAK="FALSE" ESCAPE="\">
  63.             <BEGIN>'</BEGIN>
  64.             <END>'</END>
  65.         </SPAN>
  66.  
  67.         <SPAN TYPE="LITERAL1" DELEGATE="javascript::MAIN">
  68.             <BEGIN>`</BEGIN>
  69.             <END>`</END>
  70.         </SPAN>
  71.  
  72.         <!-- Heregexps -->
  73.         <SPAN TYPE="MARKUP" DELEGATE="hereRegexp" ESCAPE="\">
  74.             <BEGIN>///</BEGIN>
  75.             <END>///</END>
  76.         </SPAN>
  77.         <!-- Javascript-style regexps -->
  78.         <SPAN_REGEXP TYPE="MARKUP" HASH_CHAR="/" AT_WORD_START="TRUE" NO_LINE_BREAK="TRUE" ESCAPE="\">
  79.             <BEGIN>/(?![\s=*])</BEGIN>
  80.             <END REGEXP="TRUE">/[igmy]{0,4}</END>
  81.         </SPAN_REGEXP>
  82.  
  83.         <MARK_PREVIOUS TYPE="FUNCTION" MATCH_TYPE="OPERATOR">(</MARK_PREVIOUS>
  84.         <!-- Seems to be equivalent to
  85.         SEQ_REGEXP TYPE="FUNCTION">([a-zA-Z\$_](\w|\$)*)(?=\s*\()</SEQ_REGEXP -->
  86.  
  87.         <SEQ TYPE="OPERATOR">)</SEQ>
  88.         <SEQ TYPE="OPERATOR">{</SEQ>
  89.         <SEQ TYPE="OPERATOR">}</SEQ>
  90.         <SEQ TYPE="OPERATOR">[</SEQ>
  91.         <SEQ TYPE="OPERATOR">]</SEQ>
  92.         <SEQ TYPE="OPERATOR">.</SEQ>
  93.  
  94.         <SEQ TYPE="OPERATOR">+</SEQ>
  95.         <SEQ TYPE="OPERATOR">/</SEQ>
  96.         <SEQ TYPE="OPERATOR">*</SEQ>
  97.         <SEQ TYPE="OPERATOR">&</SEQ>
  98.         <SEQ TYPE="OPERATOR">|</SEQ>
  99.         <SEQ TYPE="OPERATOR">\</SEQ>
  100.         <SEQ TYPE="OPERATOR">-</SEQ>
  101.         <SEQ TYPE="OPERATOR">%</SEQ>
  102.         <SEQ TYPE="OPERATOR">=</SEQ>
  103.         <SEQ TYPE="OPERATOR"><</SEQ>
  104.         <SEQ TYPE="OPERATOR">></SEQ>
  105.         <SEQ TYPE="OPERATOR">:</SEQ>
  106.         <SEQ TYPE="OPERATOR">!</SEQ>
  107.         <SEQ TYPE="OPERATOR">;</SEQ>
  108.         <SEQ TYPE="OPERATOR">^</SEQ>
  109.         <SEQ TYPE="OPERATOR">~</SEQ>
  110.         <SEQ TYPE="OPERATOR">?</SEQ>
  111.  
  112.         <SEQ_REGEXP TYPE="KEYWORD3">@([\p{L}\p{Nl}\$_][\p{L}\p{Nl}\p{Nd}\$_]*)</SEQ_REGEXP>
  113.         <SEQ_REGEXP TYPE="KEYWORD4">([\p{L}\p{Nl}\$_][\p{L}\p{Nl}\p{Nd}\$_]*)(?=\s*(?:[:\.]|\?\.))</SEQ_REGEXP>
  114.         <SEQ_REGEXP TYPE="KEYWORD1" AT_WORD_START="TRUE" HASH_CHARS="for ">for\s+own(?![\p{L}\p{Nl}\p{Nd}\$_])</SEQ_REGEXP>
  115.  
  116.         <KEYWORDS>
  117.             <KEYWORD3>this</KEYWORD3>
  118.             <KEYWORD3>super</KEYWORD3>
  119.  
  120.             <KEYWORD1>if</KEYWORD1>
  121.             <KEYWORD1>else</KEYWORD1>
  122.             <KEYWORD1>new</KEYWORD1>
  123.             <KEYWORD1>return</KEYWORD1>
  124.             <KEYWORD1>try</KEYWORD1>
  125.             <KEYWORD1>catch</KEYWORD1>
  126.             <KEYWORD1>finally</KEYWORD1>
  127.             <KEYWORD1>throw</KEYWORD1>
  128.             <KEYWORD1>break</KEYWORD1>
  129.             <KEYWORD1>continue</KEYWORD1>
  130.             <KEYWORD1>for</KEYWORD1>
  131.             <KEYWORD1>in</KEYWORD1>
  132.             <KEYWORD1>while</KEYWORD1>
  133.             <KEYWORD1>loop</KEYWORD1>
  134.             <KEYWORD1>delete</KEYWORD1>
  135.             <KEYWORD1>instanceof</KEYWORD1>
  136.             <KEYWORD1>typeof</KEYWORD1>
  137.             <KEYWORD1>switch</KEYWORD1>
  138.             <KEYWORD1>extends</KEYWORD1>
  139.             <KEYWORD1>class</KEYWORD1>
  140.             <KEYWORD1>constructor</KEYWORD1>
  141.             <KEYWORD1>do</KEYWORD1>
  142.             <KEYWORD1>then</KEYWORD1>
  143.             <KEYWORD1>unless</KEYWORD1>
  144.             <KEYWORD1>until</KEYWORD1>
  145.             <KEYWORD1>of</KEYWORD1>
  146.             <KEYWORD1>by</KEYWORD1>
  147.             <KEYWORD1>when</KEYWORD1>
  148.  
  149.             <KEYWORD1>and</KEYWORD1>
  150.             <KEYWORD1>or</KEYWORD1>
  151.             <KEYWORD1>not</KEYWORD1>
  152.             <KEYWORD1>is</KEYWORD1>
  153.             <KEYWORD1>isnt</KEYWORD1>
  154.  
  155.             <KEYWORD3>prototype</KEYWORD3>
  156.             <KEYWORD3>Array</KEYWORD3>
  157.             <KEYWORD3>Boolean</KEYWORD3>
  158.             <KEYWORD3>Date</KEYWORD3>
  159.             <KEYWORD3>Function</KEYWORD3>
  160.             <KEYWORD3>Global</KEYWORD3>
  161.             <KEYWORD3>Math</KEYWORD3>
  162.             <KEYWORD3>Number</KEYWORD3>
  163.             <KEYWORD3>Object</KEYWORD3>
  164.             <KEYWORD3>RegExp</KEYWORD3><!-- Not ECMA -->
  165.             <KEYWORD3>String</KEYWORD3>
  166.  
  167.             <!-- Literals -->
  168.             <LITERAL2>undefined</LITERAL2>
  169.             <LITERAL2>false</LITERAL2>
  170.             <LITERAL2>null</LITERAL2>
  171.             <LITERAL2>true</LITERAL2>
  172.             <LITERAL2>yes</LITERAL2>
  173.             <LITERAL2>no</LITERAL2>
  174.             <LITERAL2>on</LITERAL2>
  175.             <LITERAL2>off</LITERAL2>
  176.             <LITERAL2>NaN</LITERAL2>
  177.             <LITERAL2>Infinity</LITERAL2>
  178.  
  179.             <!-- Global functions -->
  180.             <LITERAL2>eval</LITERAL2>
  181.             <LITERAL2>parseInt</LITERAL2>
  182.             <LITERAL2>parseFloat</LITERAL2>
  183.             <LITERAL2>escape</LITERAL2>
  184.             <LITERAL2>unescape</LITERAL2>
  185.             <LITERAL2>isNaN</LITERAL2>
  186.             <LITERAL2>isFinite</LITERAL2>
  187.         </KEYWORDS>
  188.     </RULES>
  189.  
  190.     <!-- Delegate contents of #{} expression in double quotes to MAIN so that
  191.          it will be syntax highlighted as well -->
  192.     <RULES DEFAULT="LITERAL1" SET="doubleQuoteLiteral" ESCAPE="\">
  193.         <SPAN DELEGATE="MAIN" TYPE="OPERATOR">
  194.             <BEGIN>#{</BEGIN>
  195.             <END>}</END>
  196.         </SPAN>
  197.     </RULES>
  198.  
  199.     <!-- Comments and #{} interpolation in heregexes -->
  200.     <RULES DEFAULT="MARKUP" SET="hereRegexp" ESCAPE="\">
  201.         <SPAN DELEGATE="MAIN" TYPE="OPERATOR">
  202.             <BEGIN>#{</BEGIN>
  203.             <END>}</END>
  204.         </SPAN>
  205.         <EOL_SPAN TYPE="COMMENT1">#</EOL_SPAN>
  206.     </RULES>
  207.  
  208. </MODE>